<%= stylesheet_link_tag("contents_register") %>
    <div class="toolbar">
    <% if @question.user_id == current_user.id %>
        <%= link_to '編集', :action => 'edit', :id => @question.id %> | 
        <%= link_to '削除', :action => 'destroy', :id => @question.id %>
    <% end %>
    </div>

    <div id="main">
    <% form_for :question, :url => {:action => 'answer'} do |f| -%>
        <div class="qa_box">
          <div class="subtitle">分類</div>
          <div class="label">カテゴリ</div>
          <div class="field"><%= @question.category.name %></div>
          <div class="label">タグ</div>
        </div>

        <div class="qa_box">
          <div class="subtitle">問題</div>
          <%= hidden_field_tag "question_id", @question.id %>
          <div class="question"><%= @question.question_text %></div>
        </div>

        <div class="qa_box">
          <div class="subtitle">回答</div>
          <%= hidden_field_tag "question_type", @question.question_type %>
          <% if @question.question_type == 1 %>
            <% @selections.each do |s| %>
            <div class="field">
                <input type="radio" id="answer" name="answer"
                       value="<%= s.id %>" /> <%= s.selection_text %>
            </div>
            <% end %>
          <% elsif @question.question_type == 2 %>
            <% @selections.each do |s| %>
            <div class="field">
              <input type="checkbox" id="answer[<%= s.id %>]" name="answer[<%= s.id %>]"
                     value="<%= s.id %>" /> <%= s.selection_text %>
            </div>
            <% end %>
          <% else %>
            <input id="answer" name="answer" type="text" size="30" />
          <% end %>
      </div>
      <%= submit_tag "回答する" %>
    <% end -%>
